package home.projects.mocktest;

import java.util.ArrayList;
import java.util.List;

public class PerfectNumber {
	
	public boolean isPerfectNumber(int number) {
		List<Integer> list = new ArrayList<Integer>();
		list.add(1);
		for(int i = 2, max = number / 2; i <= max; ++i) {
			if(number % i == 0) {
				list.add(i);
			}
		}
		int sum = 0;
		for(Integer i : list) {
			sum += i;
		}
		return(sum == number);
	}
	
}
